﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace HMI.UIFrms
{
    /// <summary>
    /// OpenBtn.xaml 的交互逻辑
    /// </summary>
    public partial class OpenBtn : UserControl
    {
        public OpenBtn()
        {
            InitializeComponent();
        }
        public Action<bool> SelectEvent { get; set; }
        bool _isConfim = false;
        public bool IsConfim
        {
            get { return _isConfim; }
            set
            {
                SolidColorBrush bkx = FindResource("yes") as SolidColorBrush;
                SolidColorBrush bk = FindResource("yef") as SolidColorBrush;
                SolidColorBrush bkr = FindResource("no") as SolidColorBrush;
                SolidColorBrush fo = FindResource("nof") as SolidColorBrush;
                _isConfim = value;
                if (_isConfim)
                {
                    rbtn.Background = bkx;
                    rlab.Foreground = bk;
                    fbtn.Background = bkr;
                    flab.Foreground = bkr;
                }
                else
                {
                    rbtn.Background = bkr;
                    rlab.Foreground = bkr;
                    fbtn.Background = bkx;
                    flab.Foreground = bk;
                }
                if (SelectEvent != null)
                    SelectEvent(_isConfim);
            }
        }

    }
}
